

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class MaxTempRunner extends Configured implements Tool{
	public static void main(String[] args) throws Exception {
		int result=ToolRunner.run(new Configuration(), new MaxTempRunner(), args);
		System.exit(result);
	}

	@Override
	public int run(String[] arg0) throws Exception {
		Configuration conf=new Configuration();
		Job job=new Job(conf);
		
		job.setJobName("MaxTemp");
		job.setJarByClass(MaxTempMapper.class);
		
		job.setMapperClass(MaxTempMapper.class);
		job.setReducerClass(MaxTempReducer.class);
		
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(IntWritable.class);
		
		FileInputFormat.setInputPaths(job, new Path("hdfs://slave1:9000/user/hadoop/data"));
		FileOutputFormat.setOutputPath(job, new Path("hdfs://slave1:9000/user/hadoop/output"));
		
		return job.waitForCompletion(true)?1:0;
	}

	
	
}
